<!DOCTYPE html>
<html  xmlns="http://www.w3.org/1999/xhtml"
       xmlns:th="http://www.thymeleaf.org"
       xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="static/css/index.css">
    <script src="static/js/vue.js"></script>
    <script src="static/js/index.js"></script>
    <script src="static/js/axios.min.js"></script>

    <style>
        .el-header, .el-footer {
            background-color: #E9EEF3;
            color: #333;
            text-align: center;
            line-height: 60px;
        }

        el-aside {
            background-color: #E9EEF3;
            color: #333;
            text-align: center;
            line-height: 200px;
        }

        el-main {
            background-color: #E9EEF3;
            color: #333;
            text-align: center;
            line-height: 160px;
        }

        body > .el-container {
            margin-bottom: 40px;
        }

        .el-container:nth-child(5) .el-aside,
        .el-container:nth-child(6) .el-aside {
            line-height: 260px;
        }

        .el-container:nth-child(7) .el-aside {
            line-height: 320px;
        }
    </style>

</head>
<body>
<div id="app">

    <el-container style="height: 800px; border: 1px solid #eee">
        <el-aside width="200px" >

            <el-row class="tac">
                <el-col :span="24">
                    <el-menu
                            default-active="2"
                            class="el-menu-vertical-demo"
                            @open="handleOpen"
                            @close="handleClose"
                            @select="aaa"
                            background-color="#545c64"
                            text-color="#fff"
                            active-text-color="#ffd04b">
                        <el-submenu index="0">
                            <template slot="title">
                                <h4><img id="u_img" class="img "
                                         src="static/image/logo.png"
                                    width="30%">
                                    LMS信贷系统</h4>
                            </template>

                        </el-submenu>
                        <el-menu-item id="m_01" index="dashboard" @click="changeNav('m_01')">
                            <i class="el-icon-menu"></i>
                            <span slot="title">仪表盘</span>
                        </el-menu-item>

                        <el-submenu index="1">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>客户管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="customer" id="m_02" @click="changeNav('m_02')">合作客户</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        <el-submenu index="2">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>订单管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="apply" id="m_03" @click="changeNav('m_03')">申请列表</el-menu-item>
                                <el-menu-item index="1-1" id="m_04" @click="changeNav('m_04')">初审列表</el-menu-item>
                                <el-menu-item index="1-1" id="m_05" @click="changeNav('m_05')">复审列表</el-menu-item>
                                <el-menu-item index="1-1" id="m_06" @click="changeNav('m_06')">终审列表</el-menu-item>
                            </el-menu-item-group>

                        </el-submenu>
                        <el-submenu index="3">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>放款管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="waitloan" id="m_07" @click="changeNav('m_07')">待放款订单</el-menu-item>
                                <el-menu-item index="haslend" id="m_08" @click="changeNav('m_08')">已放款订单</el-menu-item>
                                <el-menu-item index="allorder" id="m_09" @click="changeNav('m_09')">账单列表</el-menu-item>
                            </el-menu-item-group>

                        </el-submenu>

                        <el-submenu index="4">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>逾期管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="duea" id="m_11" @click="changeNav('m_11')">逾期0-3天</el-menu-item>
                                <el-menu-item index="dueb" id="m_12" @click="changeNav('m_12')">逾期3-7天</el-menu-item>
                                <el-menu-item index="duec" id="m_13" @click="changeNav('m_13')">逾期7-30天</el-menu-item>
                                <el-menu-item index="dued" id="m_14" @click="changeNav('m_14')">逾期30天以上</el-menu-item>
                                <el-menu-item index="duee" id="m_15" @click="changeNav('m_15')">全部逾期</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        <el-submenu index="5">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>催收管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="collection"id="m_18" @click="changeNav('m_18')">催收列表</el-menu-item>
                            </el-menu-item-group>

                        </el-submenu>

                        <el-submenu index="6">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>抵质押物管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="vehicle"id="m_19" @click="('m_19')">车辆管理</el-menu-item>
                                <el-menu-item index="house"id="m_20" @click="changeNav('m_20')">房产管理</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="7">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>渠道管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="moneyditch" id="m_21" @click="changeNav('m_21')">资金渠道</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        <el-submenu index="8">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>产品管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="product"id="m_23" @click="openproduct()">合作产品</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        <el-submenu index="9">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>财务管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="putmoney"id="m_24" @click="changeNav('m_24')">放款明细</el-menu-item>
                                <el-menu-item index="returnmoney"id="m_25" @click="changeNav('m_25')">回款明细</el-menu-item>
                                <el-menu-item index="platservice"id="m_26" @click="changeNav('m_26')">平台服务费</el-menu-item>
                                <el-menu-item index="moneyset"id="m_27" @click="changeNav('m_27')">资金方结算</el-menu-item>
                            </el-menu-item-group>

                        </el-submenu>

                        <el-submenu index="10">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>统计管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="userconversion"id="m_29" @click="changeNav('m_29')">用户转化数据</el-menu-item>
                                <el-menu-item index="opdata"id="m_30" @click="changeNav('m_30')">运营数据</el-menu-item>
                                <el-menu-item index="finance"id="m_31" @click="changeNav('m_31')">财务统计</el-menu-item>
                                <el-menu-item index="overdue"id="m_32" @click="changeNav('m_32')">逾期统计</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>

                        <el-submenu index="11">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>系统管理</span>
                            </template>
                            <el-menu-item-group>
                                <shiro:hasPermission name="acount_mana;">
                                <el-menu-item index="account_mag" id="m_33" @click="changeNav('m_33')">账号管理</el-menu-item>
                                </shiro:hasPermission>

                                <shiro:hasPermission name="role_mana;">
                                <el-menu-item index="role_mag"id="m_34" @click="changeNav('m_34')">角色管理</el-menu-item>
                                </shiro:hasPermission>

                                <shiro:hasPermission name="sys_log;">
                                <el-menu-item index="system_log" id="m_36" @click="changeNav('m_36')">系统日志</el-menu-item>
                                </shiro:hasPermission>

                                <el-menu-item index="download_center"id="m_38" @click="changeNav('m_38')">下载中心</el-menu-item>
                                <el-menu-item index="data_dictionary"id="m_39" @click="changeNav('m_39')">数据字典</el-menu-item>
                                <el-menu-item :index="companyPath"id="m_41" @click="changeNav('m_41')">公司信息</el-menu-item>
                                <el-menu-item index="process_model"id="m_42" @click="changeNav('m_42')">流程模型</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                    </el-menu>
                </el-col>
            </el-row>
        </el-aside>
        <el-container>
            <el-header style="font-size: 16px;background-color: white;top:0px" >
                <el-breadcrumb separator-class="el-icon-arrow-right" style="padding-top: 20px;">
                    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                    <el-breadcrumb-item>{{current}}</el-breadcrumb-item>


                    <!-- Form -->
                    <span style="float: right">
                    <el-button  type="text" @click="open"><span class="el-icon-key" >修改密码</span></el-button>

                    <el-dialog title="修改密码" :visible.sync="dialogFormVisible">
                        <el-form :model="form">
                            <el-form-item label="新密码" :label-width="formLabelWidth">
                                <el-input v-model="form.password" type="password" autocomplete="off"></el-input>
                            </el-form-item>
                            <el-form-item label="确认密码" :label-width="formLabelWidth">
                                <el-input v-model="form.surePassword" type="password" autocomplete="off"></el-input>
                            </el-form-item>

                        </el-form>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="dialogFormVisible = false">取 消</el-button>
                            <el-button type="primary" @click="dialogFormVisible = false,updateMyPassword()">确 定</el-button>
                        </div>
                    </el-dialog>

                    <el-dropdown style="padding-top: 20px;padding-left: 20px;">

                                 <span class="el-icon-user-solid">
                                 <span><shiro:principal/></span><i class="el-icon-arrow-down el-icon--right"></i></span></i>

                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item><a href ="javascript:void(0)" id="Exit_system"  @click="exit"><i class="icon-off"></i>退出系统</a></li></el-dropdown-item>

                        </el-dropdown-menu>
                    </el-dropdown>
                </span>
                </el-breadcrumb>


            </el-header>

            <el-main>
                <Iframe id="ifr" src="dashboard" width="100%" height="690"
                        frameborder="0"></Iframe>
            </el-main>

        </el-container>
    </el-container>

</div>


</body>

<script type="text/javascript" th:inline="javaScript">


    let app=new Vue({
        el: '#app',
        data:{
            current:"仪表盘",
            companyPath:"",
            form: {
                password: '',
                surePassword: '',
                region: '',
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                desc: ''
            },
            formLabelWidth: '120px',
            dialogFormVisible: false,

        },

        methods: {
            //登录用户，修改自己的密码
            updateMyPassword:()=>{
                if (app.form.password != app.form.surePassword){
                    alert("两次输入的密码不一致");
                }else if(app.form.password=='' || app.form.surePassword==''){
                    alert("输入密码为空");
                }else {
                    let params =new FormData();
                    params.append("password",app.form.password);
                    //后端shiro用userName来作为盐值加密密码。 后端从shiro的session中去用户名
                    axios.put([[@{/user/updateMyPassword}]],params)
                    .then(res => {
                        console.log(res);
                        if (res.data.code == 200){
                            alert("修改密码成功");
                        }
                        location.reload();
                    }).catch(function (error) {
                        console.log(error);
                    });
                }
            },

            handleOpen(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            },
            aaa(index, indexPath) {
                document.getElementById("ifr").src=index;

            },
            open:function () {

                this. dialogFormVisible=true;
            },

            //退出登录
            exit:function () {
                axios.get([[@{sys/logout}]],{
                    params:{
                    }
                })
            .then(res => {//此处一定要用 箭头函数  不然this 就不是this
                    console.log("res="+res);
                    console.log("res.data="+res.data);
                    if (res.data.code == 200){
                       alert("退出登录成功");
                    }
                    //跳转到首页
                    location.href=[[@{login}]];
                        // window.location.href="login";
                })
                    .catch(error => {
                        console.log(error);
                    });
            },
            changeNav:function (id) {
               this.current=document.getElementById(id).innerText;

            },
            openproduct:function(){

            }
        },//methods方法结束
        created:function(){
            axios.get("com/findAll"
            ).then(res=>{
                console.log(res);
                if (res.data.msg == "haveData"){
                    this.companyPath = "company_detail";
                }else {
                    this.companyPath = "company";
                }
            })
        }
    })
</script>
</html>